package fschmidt.util.executor;


public final class JettyThreadPool implements org.eclipse.jetty.util.thread.ThreadPool {
	private final ThreadPool threadPool;

	public JettyThreadPool(ThreadPool threadPool) {
		this.threadPool = threadPool;
	}

	@Override public boolean dispatch(Runnable job) {
		return threadPool.dispatch(job);
	}

	@Override public void join() throws InterruptedException {
		threadPool.join();
	}

	@Override public int getThreads() {
		return threadPool.getPoolSize();
	}

	@Override public int getIdleThreads() {
		return threadPool.getPoolSize() - threadPool.getActiveCount();
	}

	@Override public boolean isLowOnThreads() {
		return getIdleThreads() == 0;
	}

}
